package com.datang.litejvm.constant;

import com.datang.litejvm.print.Visitor;

public abstract class ConstantInfo {
    public static final int CONSTANT_UTF8_INFO = 1;
    public static final int CONSTANT_CLASS_INFO = 7;
    public static final int CONSTANT_STRING_INFO = 8;
    public static final int CONSTANT_FIELD_REF_INFO = 9;
    public static final int CONSTANT_METHOD_REF_INFO = 10;
    public static final int CONSTANT_NAME_AND_TYPE_INFO = 12;
    protected ConstantPool constantPool;

    public ConstantInfo(ConstantPool pool) {
        this.constantPool = pool;
    }

    public abstract int getTag();

    public abstract String getValue();

    public ConstantPool getConstantPool() {
        return constantPool;
    }

    public ConstantInfo getConstantInfo(int index) {
        return this.constantPool.getConstantInfo(index);
    }

    public abstract void accept(Visitor visitor);


}
